package com.pzhu.dormitory.config;


import com.pzhu.dormitory.utils.R;
import com.pzhu.dormitory.utils.Rb;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author liupeng
 */
@RestControllerAdvice
@Slf4j
public class MyExceptionHandler {
    @ExceptionHandler(value = Exception.class)
    public R<String> exceptionHandler(Exception e) {
        return Rb.a(String.class).fail().withMsg(e.getMessage()).build();
    }

}
